import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { knowledge, system, aiqa } from '@/api/apiModulesType';

// 查询团队文档
export function apiTeamQuery(params) {
  return request({
    url: `${knowledge}/api/team/query`,
    method: 'get',
    params
  });
}
// 新建团队文档
export function apiTeamPost(data) {
  return request({
    url: `${knowledge}/api/team/add`,
    method: 'post',
    data
  });
}
// 获取团队空间大小
export function apiCoreConfigGetByConfigCode(params) {
  return request({
    url: `${knowledge}/api/coreConfig/getByConfigCode`,
    method: 'get',
    params: params
  });
}
// 获取团队成员
export function apiTeamMemberQuery(params) {
  return request({
    url: `${knowledge}/api/teamMember/query`,
    method: 'get',
    params
  });
}
// 个人模板库
export function apicreateTemplateCenter(data) {
  return request({
    url: `${knowledge}/api/enterpriseTemplateTree/createTemplateCenter`,
    method: 'post',
    data
  });
}
// 查询部门（无权限）
export const apiuDeptQueryFreePerm = (query?: any): AxiosPromise<any[]> => {
  return request({
    url: `/${system}/dept/queryFreePerm`,
    method: 'get',
    params: query
  });
};

// 查询角色（无权限）
export const apiRoleQueryFreePerm = (query?: any): AxiosPromise<any[]> => {
  return request({
    url: `/${system}/role/allUnlimited`,
    method: 'get',
    params: query
  });
};

// 查询用户(无权限)
export const apiuUserQueryFreePerm = (query?: any): AxiosPromise<any[]> => {
  return request({
    url: `/${system}/user/queryFreePerm`,
    method: 'get',
    params: query
  });
};

// 查询岗位（无权限）
export const apiJobQueryFreePerm = (query?: any): AxiosPromise<any[]> => {
  return request({
    url: `/${system}/post/queryUnlimited`,
    method: 'get',
    params: query
  });
};
//获取系统用户
export function getUserFreePerm(params) {
  return request({
    url: `${system}/api/users/getUserFreePerm`,
    method: 'get',
    params
  });
}
// 查询部门
export function apiDeptQueryFreePerm(params) {
  return request({
    url: `${system}/api/dept/queryFreePerm`,
    method: 'get',
    params
  });
}
// 角色权限查询
export function apiRolesAllUnlimited(params) {
  return request({
    url: `${system}/api/roles/allUnlimited`,
    method: 'get',
    params
  });
}
// 岗位权限查询
export function apiJobQueryUnlimited(params) {
  return request({
    url: `${system}/api/job/queryUnlimited`,
    method: 'get',
    params
  });
}
export function apiUsersQueryFreePerm(params) {
  return request({
    url: `${system}/api/users/queryFreePerm`,
    method: 'get',
    params
  });
}

//新增团队成员
export function apiTeamMemberAdd(data) {
  return request({
    url: `${knowledge}/api/teamMember/add`,
    method: 'post',
    data
  });
}
//删除团队成员
export function apiTeamMemberDelete(data) {
  return request({
    url: `${knowledge}/api/teamMember/delete`,
    method: 'post',
    data
  });
}
//删除团队文档成员
export function apiTeamRelevanceRoleDelete(data) {
  return request({
    url: `${knowledge}/api/teamRelevanceRole/delete`,
    method: 'post',
    data
  });
}
// 设置默认角色
export function apiTeamSetDefaultRole(data) {
  return request({
    url: `${knowledge}/api/team/setDefaultRole`,
    method: 'post',
    data
  });
}
//单个团队成员修改权限
export function apiTeamMemberUpdateUserRoleType(data) {
  return request({
    url: `${knowledge}/api/teamMember/updateUserRoleType`,
    method: 'post',
    data
  });
}
//单个团队文档成员修改权限
export function apiTeamRelevanceRoleUpdateUserRoleType(data) {
  return request({
    url: `${knowledge}/api/teamRelevanceRole/updateUserRoleType`,
    method: 'post',
    data
  });
}
//根据id获取团队信息
export function apiTeamGetInformation(params) {
  return request({
    url: `${knowledge}/api/team/getInformation`,
    method: 'get',
    params
  });
}
//查询团队文档权限 - 查询该文件的团队成员
export function apiTeamRelevanceRoleQuery(params) {
  return request({
    url: `${knowledge}/api/teamRelevanceRole/query`,
    method: 'get',
    params
  });
}
//查询文件查看记录
export function apiFilesRecentlyViewedCheck(params) {
  return request({
    url: `${knowledge}/api/filesRecentlyViewed/check`,
    method: 'get',
    params
  });
}
//添加团队文档成员
export function apiTeamRelevanceRoleAdd(data) {
  return request({
    url: `${knowledge}/api/teamRelevanceRole/add`,
    method: 'post',
    data
  });
}
// 团队获取团队消息
export function apiTeamGetTeamMessage(params) {
  return request({
    url: `${knowledge}/api/team/get-team-message`,
    method: 'get',
    params
  });
}
//修改团队文档
export function apiTeamUpdate(data) {
  return request({
    url: `${knowledge}/api/team/update`,
    method: 'post',
    data
  });
}
// 查询一级回收站
export const ApiPerSelectRecycle = function (params?: any) {
  return request({
    method: 'get',
    url: `/${knowledge}/recycleBin/selectRecycle`,
    params: params
  });
};

// 回收站一级回收站回收站数据移动到二级回收站
export const ApiPerDelRecycle = function (params?: any) {
  return request({
    method: 'get',
    url: `/${knowledge}/recycleBin/delete/recycle`,
    params: params
  });
};
// 一级回收站恢复文件(post请求,get传参)
export const ApiPerRecoverFile = function (params?: any) {
  return request({
    method: 'post',
    url: `/${knowledge}/recycleBin/recoverFile`,
    params: params
  });
};
// 删除团队文档
export function apiTeamdDelete(params) {
  return request({
    url: `/${knowledge}/api/team/delete`,
    method: 'get',
    params
  });
}
// 高级设置里的修改管理员
export function apiTeamOwnerHandOver(data) {
  return request({
    url: `${knowledge}/api/team/ownerHandOver`,
    method: 'post',
    data
  });
}
// 接收文件
export const ApiPerReceiveFile = function (data?: any) {
  return request({
    method: 'post',
    url: `/${knowledge}/api/filesDistribute/receiveFile`,
    data: data
  });
};
// 查询分发(get接口post传参)
export const ApiPerQueryDistribute = function (params?: any) {
  return request({
    method: 'get',
    url: `/${knowledge}/api/filesDistribute/queryDistribute`,
    params: params
  });
};
// 查询接收(get接口post传参)
export const ApiPerQuerySend = function (params?: any) {
  return request({
    method: 'get',
    url: `/${knowledge}/api/filesDistribute/querySend`,
    params: params
  });
};
// 查看接收人
export const ApiPerFilesSender = function (params?: any) {
  return request({
    method: 'get',
    url: `/${knowledge}/api/filesDistributeSender/query`,
    params: params
  });
};
// 撤回分发
export const ApiPerFilesDelete = function (params?: any) {
  return request({
    method: 'get',
    url: `/${knowledge}/api/filesDistribute/delete`,
    params: params
  });
};
//链接分享查询
export const ApiPerSharePerson = (query?: any): AxiosPromise<any[]> => {
  return request({
    method: 'get',
    url: `/${knowledge}/api/filesShare/sharePerson`,
    params: query
  });
};
// 收到链接查询
export const ApiPerSharedPerson = function (params?: any) {
  return request({
    method: 'get',
    url: `/${knowledge}/api/filesShare/sharedPerson`,
    params: params
  });
};
// 分享链接:删除链接分享
export const ApiPerDeleteShare = function (ids?: any) {
  return request({
    method: 'delete',
    url: `/${knowledge}/api/filesShare`,
    data: ids
  });
};
// 分享链接:一键删除所有无效分享
export const ApiPerDelAllByType = function (params?: any) {
  return request({
    method: 'get',
    url: `/${knowledge}/api/filesShare/delAllByType`,
    params: params
  });
};
// 删除收到的链接分享
export const ApiPerreceivedDel = function (ids?: any) {
  return request({
    method: 'delete',
    url: `/${knowledge}/api/filesShare/received/delete`,
    data: ids
  });
};
// 分享链接:通过id查询对应的链接
export const ApiPerfilesShareId = function (params?: any) {
  return request({
    method: 'get',
    url: `/${knowledge}/api/filesShare/id`,
    params: params
  });
};
// 分享链接:修改链接分享
export const ApiPerEditShare = function (data?: any) {
  return request({
    method: 'put',
    url: `/${knowledge}/api/filesShare`,
    data: data
  });
};
// 多个文件添加标签
export function apiFilesLabelRecordCreateList(data) {
  return request({
    url: `${knowledge}/api/filesLabelRecord/createList`,
    method: "post",
    data
  });
}

// 新增标签记录
export function apiFilesLabelRecordCreate(data) {
  return request({
    url: `${knowledge}/api/filesLabelRecord/create`,
    method: "post",
    data
  });
}
// 查询标签记录已添加的文件
export function apiFilesLabelRecordQuerySelect(params) {
  return request({
    url: `${knowledge}/api/filesLabelRecord/querySelect`,
    method: "get",
    params
  });
}
// 获取列表数据
export function apiFilesUserLabelGetData(params) {
  return request({
    url: `${knowledge}/filesUserLabel/queryTeam`,
    method: "get",
    params
  });
}
// 获取打印记录
export function apiFlePrintLog(params) {
	return request({
		url: `resource/api/filePrintLog`,
		method: 'get',
		params,
	})
}